import { defHttp } from '@/utils/http/axios';
import { RequestEnum } from '@/enums/httpEnum';
import { ServicePrefixEnum } from '@/enums/commonEnum';
import type { AxiosRequestConfig } from 'axios';

const MODULAR = '/system/social-client';

export const Api = {
  GetSocialClientPage: {
    url: `${ServicePrefixEnum.BASE}/${MODULAR}/page`,
    method: RequestEnum.GET,
  } as AxiosRequestConfig,
  GetSocialClient: {
    url: `${ServicePrefixEnum.BASE}/${MODULAR}/get`,
    method: RequestEnum.GET,
  } as AxiosRequestConfig,
  CreateSocialClient: {
    url: `${ServicePrefixEnum.BASE}/${MODULAR}/create`,
    method: RequestEnum.POST,
  } as AxiosRequestConfig,
  UpdateSocialClient: {
    url: `${ServicePrefixEnum.BASE}/${MODULAR}/update`,
    method: RequestEnum.PUT,
  } as AxiosRequestConfig,
  DeleteSocialClient: {
    url: `${ServicePrefixEnum.BASE}/${MODULAR}/delete`,
    method: RequestEnum.DELETE,
  } as AxiosRequestConfig,
}


// 查询社交客户端列表
export const getSocialClientPage = async (params) => {
  return await defHttp.request({ ...Api.GetSocialClientPage,params})
}

// 查询社交客户端详情
export const getSocialClient = async (id: number) => {
  return await defHttp.request({ ...Api.GetSocialClient,params:{id}})
}

// 新增社交客户端
export const createSocialClient = async (data: SocialClientVO) => {
  return await defHttp.request({ ...Api.CreateSocialClient,params:data})
}

// 修改社交客户端
export const updateSocialClient = async (data: SocialClientVO) => {
  return await defHttp.request({ ...Api.UpdateSocialClient,params:data})
}

// 删除社交客户端
export const deleteSocialClient = async (id: number) => {
  return await defHttp.request({ ...Api.DeleteSocialClient,params:{id}})
}


export interface SocialClientVO {
  id: number
  name: string
  socialType: number
  userType: number
  clientId: string
  clientSecret: string
  agentId: string
  status: number
}

// // 查询社交客户端列表
// export const getSocialClientPage = async (params) => {
//   return await request.get({ url: `/system/social-client/page`, params })
// }
//
// // 查询社交客户端详情
// export const getSocialClient = async (id: number) => {
//   return await request.get({ url: `/system/social-client/get?id=` + id })
// }
//
// // 新增社交客户端
// export const createSocialClient = async (data: SocialClientVO) => {
//   return await request.post({ url: `/system/social-client/create`, data })
// }
//
// // 修改社交客户端
// export const updateSocialClient = async (data: SocialClientVO) => {
//   return await request.put({ url: `/system/social-client/update`, data })
// }
//
// // 删除社交客户端
// export const deleteSocialClient = async (id: number) => {
//   return await request.delete({ url: `/system/social-client/delete?id=` + id })
// }
